import { App } from "vue";

//防抖封装   
export const regDebounce = (app: App<Element>) => {
    // 触发的
    app.directive("debounce", {
        mounted(el, binding) {
            let timer: any;
            el.addEventListener("click", () => {
                clearTimeout(timer);
                timer = setTimeout(() => {
                    // 延迟执行的代码
                    binding.value()
                }, 1000)
            })
        }
    })
}